﻿

<MDialog @bind-Value="Dialog"
         Width="600">
    <MDCard>
        <MCardTitle Class="text-h5">
            预览文章
        </MCardTitle>
        <MCardText>
            仅供参考，发布后的布局可能会有略微差别
        </MCardText>
        <MCardText>
            <img src="@Model.MainPicture" alt="@Model.Name" style="width:100%" />
            <div style="display:flex;" class="mt-3 mb-3">
                <dic style="display: flex;align-items: center;">
                    <img class="shadow-sm" src="@Model.UserInfor.PhotoPath" alt="@Model.UserInfor.Name" style="height: 50px;width: 50px;border-radius: 50%;" />
                </dic>
                <div class="ms-2" style="display: flex; flex-direction: column; justify-content: space-between; font-size: initial;">
                    <div>@Model.UserInfor.Name</div>
                    <div style="color:gray;">@Model.PubishTime?.ToTimeFromNowString()</div>
                </div>
            </div>
            <CnGalWebSite.Shared.MasaComponent.Shared.Components.Markdown.MarkdownViewTip Text="@Model.MainPage" />
            @foreach(var item in Model.RelatedEntries)
            {
                <CnGalWebSite.Shared.MasaComponent.PC.Home.Cards.Shared.IconChip Text="@item.Name"/>
            }
        </MCardText>
           

        <MCardActions>
            <MSpacer></MSpacer>
            <MButton Color="green darken-1"
                     Text
                     OnClick=" ()=>Dialog = false">
                关闭
            </MButton>
        </MCardActions>
    </MDCard>
</MDialog>
@code {

    private ArticleViewModel Model { get; set; }


    [CascadingParameter]
    public ErrorHandler ErrorHandler { get; set; }

    bool Dialog { get; set; }


    protected override async Task OnInitializedAsync()
    {

    }
    public void Refresh(bool dialog, ArticleViewModel model)
    {
        Dialog = dialog;
        Model = model;


        StateHasChanged();

        
    }

}
